// ------------------------------------------------------------------
// Hack.ScreenCapturing.DirectX.Capture
//
// History:
//	2003-Jan-24		BL		- created
//
// Copyright (c) 2003 Brian Low
// ------------------------------------------------------------------

using System;
using System.Collections;
using System.Runtime.InteropServices;
using Hack.ScreenCapturing.DirectShowLib;
using System.Runtime.InteropServices.ComTypes;

namespace Hack.ScreenCapturing.DirectX.Capture
{
	/// <summary>
	///  Represents a DirectShow filter (e.g. video capture device,
	///  compression codec).
	/// </summary>
	public class Filter
	{
        protected DsDevice Dev;

        /// <summary> Human-readable name of the filter </summary>
        public string Name
        {
            get
            {
                return Dev.Name;
            }
        }

        /// <summary>Get the IBaseFilter from the device</summary>
        /// <returns>The IBaseFilter</returns>
        public IBaseFilter GetIBaseFilter()
        {
            // Query for IBaseFilter
            Guid iid = typeof(IBaseFilter).GUID;

            object source;

			Dev.Mon.BindToObject(null, null, ref iid, out source);

            return (IBaseFilter)source;
        }

		/// <summary> Create a new filter from a device</summary>
		internal Filter( DsDevice dev)
		{
            Dev = dev;
		}
	}
}
